import { createRouter, RouterMount, runtimeQuit } from 'uni-simple-router';
import Vue from 'vue';

const router = createRouter({
  platform: process.env.VUE_APP_PLATFORM,
  routes: [...ROUTES],
  //买家端无需路由拦截，接口请求守卫跳转登录
  routerBeforeEach: (to, from, next) => {
    next();
  },
  routerErrorEach: ({ type }) => {
    // #ifdef APP-PLUS
    if (type === 3) {
      router.$lockStatus = false;
      runtimeQuit();
    }
    // #endif
  },
});

Vue.use(router);

export { router, RouterMount };
